package com.zxl.always.on.display.ui.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.zxl.always.on.display.R;

/**
 * Created by Administrator on 2018/2/26.
 */

public class SingleSettingItem extends FrameLayout {

    private String title;

    public SingleSettingItem(Context context, AttributeSet attrs) {
        super(context, attrs);
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.SettingItem);
        title = typedArray.getString(R.styleable.SettingItem_text);
        typedArray.recycle();
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        LayoutInflater.from(getContext()).inflate(R.layout.widget_single_settings_item, this, true);
        TextView titleView = findViewById(R.id.title);
        if (!TextUtils.isEmpty(title)) {
            titleView.setText(title);
        }
    }
}
